package com.tenglong.user.service.impl;


import com.tenglong.user.dao.SysUserMapper;
import com.tenglong.user.pojo.SysUser;
import com.tenglong.user.pojo.SysUserExample;
import com.tenglong.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("userServiceImpl")
public class UserServiceImpl implements UserService{

    @Autowired
    private SysUserMapper userMapper;


    @Override
    public List<SysUser> getUserList() {
        SysUserExample example=new SysUserExample();
        List<SysUser> userList=userMapper.selectByExample(example);
        if (userList.isEmpty()){
            return new ArrayList<SysUser>();
        }
        return userList;
    }

    @Override
    public SysUser getUserDetails(String name) {
        SysUser user=userMapper.selectUserByName(name);
        return user;
    }
}
